<?php
/*系统邮箱设置*/
require (dirname(dirname(__FILE__)).'/common/common.php');
admin_check('ajax');//管理员验证

$gbook_email_come = isset($_POST['gbook'])?$_POST['gbook']:0;
$gbook_email_go = isset($_POST['job'])?$_POST['job']:0;

$job_email_come = isset($_POST['job'])?$_POST['job']:0;
$job_email_go = isset($_POST['gbook'])?$_POST['gbook']:0;

$email_zt = isset($_POST['zt'])?$_POST['zt']:"qq";
$email_user = isset($_POST['user'])?$_POST['user']:null;
$email_psw = isset($_POST['pwd'])?$_POST['pwd']:null;
$email_port = isset($_POST['port'])?$_POST['port']:465;
$email_shoujian = isset($_POST['shoujian'])?$_POST['shoujian']:null;

if($email_zt && $email_user &&$email_port){
	
	$display_order = array(
    15 => $gbook_email_come,
    16 => $gbook_email_go,
    20 => $job_email_come,
    21 => $job_email_go,
    17 => $email_zt,
    18 => $email_user,
    19 => $email_psw,
    10 => $email_port,
	45 => $email_shoujian
    );
//print_r($display_order);

$ids = implode(',', array_keys($display_order));

$sql = "UPDATE ".lc()."_config SET lc_value = CASE lc_id ";
foreach ($display_order as $id => $ordinal) {
	//echo $ordinal."  ";
	
	$sql .= "WHEN {$id} THEN '{$ordinal}' ";
   // $sql .= sprintf("WHEN %d THEN %x ", $id, $ordinal);
	

}
$sql .= "END WHERE lc_id IN ($ids)";
if(mysql_query($sql)){
	echo 1;
	}else{
	echo 2;	
	}

	
	
}else{
	echo "-1";//必填参数不能为空
}
?>